package com.formation.tocea.library.client.listener;

import com.formation.tocea.library.client.ui.form.LoginForm;
import com.formation.tocea.library.client.ui.main.Menu;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.RootPanel;

public class HideFormListener implements ClickHandler {
	private Grid form;

	public HideFormListener(Grid form) {
		this.form = form;
	}

	public void onClick(ClickEvent event) {
		Menu menu = (Menu) RootPanel.get("menu").getWidget(0);
		menu.remove(form);
		
		if (form instanceof LoginForm) {
			menu.getConnectButton().setEnabled(true);
		}
	}
}
